<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>宫小白官网-高科技完美护肤品牌</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="description" content="宫小白，是宫森集团旗下集齐所有科研人员致力打造出来的一款高科技完美护肤品牌，提倡纯天然护肤，专为亚洲男女性的肌肤护理，详情登陆宫小白官网:gongxiaobai.cn" />
		<meta name="keywords" content="宫小白,宫小白官网,宫小白代理,宫小白微商,宫森集团,化妆品,护肤品,香港" />
		
		<link rel="stylesheet" href="./css/common.css" />
		<script type="text/javascript" src="js/common.js" ></script>
	</head>
	<body>
		<div id="mobile-top">
			<img src="./img/mobile-logo.jpg" alt="宫小白" />
		</div>
		<div id="navbar" class="navbar">
			<a href="index.html" class="item item-l">首页</a>
			<a href="products.html" class="item item-l">产品</a>
			<a href="company.html" class="item item-l">公司</a>
			<a href="index.html" class="item logo">
				<img src="./img/logo.jpg" src="宫小白" />
			</a>
			<div class="fr">
				<a href="security.html" class="item item-l active">授权查询</a>
				<a href="code.html" class="item item-l">防伪查询</a>
				<a href="contacts.html" class="item item-l">联系我们</a>
			</div>
        </div>
       
        <div class="banner br mt20">
       	</div>
		
		<div class="container code">
			<div class="form-wrapper">
				<h1 class="title">授权查询 .</h1>
				<h3 class="tips">请输入授权微信号/手机号/经销商编号，点击“查询”获得结果</h3>
				<form class="form-line mt50">
					<input type="text" id="code" name="code" placeholder="微信号/手机号/经销商编号" />
					<a href="javascript:void(0);" class="btn" id="checkBtn">查询</a>
				</form>
				<div class="result mt50 hidden" id="result">
					<div class="info first"></div>
					<div class="info second"></div>
				</div>
			</div>
		</div>
		
		<footer></footer>
		
		<script src="./js/jquery.min.js"></script>
		<script src="./js/layer/layer.js"></script>
		<script>
			$(function(){
				$('#checkBtn').click(function(){
					checkCode();
				});
			});
			
			function checkCode(){
				var code = $('#code').val();
				if(!code){
					layer.alert('请输入授权微信号/手机号/经销商编号！', {icon: 2});
					return false;
				}
				$('#result').removeClass('hidden');
				
				$.ajax({
						url: '/dealer/check',
						type: 'get',
						data: {'checkCode': code},
						success: function(data){
							if(data != null && data.flag){
								$('#result .first').html(data.dealerName);
								// 合伙人、联合创始人、官方董事、总代、会员
								if(data.grade == 1){
									$('#result .second').html('<span class="success">宫小白系列</span><span class="success">合伙人</span>');
								}else if(data.grade == 2){
									$('#result .second').html('<span class="success">宫小白系列</span><span class="success">联合创始人</span>');
								}else if(data.grade == 3){
									$('#result .second').html('<span class="success">宫小白系列</span><span class="success">官方董事</span>');
								}else if(data.grade == 4){
									$('#result .second').html('<span class="success">宫小白系列</span><span class="success">总代</span>');
								}else if(data.grade == 5){
									$('#result .second').html('<span class="success">宫小白系列</span><span class="success">会员</span>');
								}else{
									$('#result .second').html('<div class="error">您查询的代理信息不存在，谨防假冒伪劣！</div>');
								}
							}else{
								$('#result .first').html('');
								$('#result .second').html('<div class="error">您查询的代理信息不存在，谨防假冒伪劣！</div>');
							}
						},
						error : function(jqXHR) {
							layer.alert("请稍后再访问，发生错误" + jqXHR.status, {icon: 2});
						} 
					});
			}
			
		</script>
	</body>
</html>
